﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.Text;
using System.IO;
using System.Data;
using System.Configuration;


namespace WebCinesItech
{
    public partial class frmPromociones : System.Web.UI.Page
    {
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            //CallbackManager.Register(ConsultarPromociones);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
            //    HttpWebRequest req = WebRequest.Create("http://localhost:20949/restservice") as HttpWebRequest;
            //    req.KeepAlive = false;
            //    req.Method = "GET";
            //    HttpWebResponse resp = req.GetResponse() as HttpWebResponse;
            //    Encoding enc = System.Text.Encoding.GetEncoding(1252);
            //    StreamReader loResponseStream = new StreamReader(resp.GetResponseStream(), enc);
            //    string Response = loResponseStream.ReadToEnd();
            //    var tbl = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(Response);
            //    DropDownList1.DataSource = tbl;
            //    DropDownList1.DataTextField = "Nombre";
            //    DropDownList1.DataValueField = "Codcine";
            //    DropDownList1.DataBind();
            }
        }


        public string ConsultarPromociones(string codigoCine) {
            //string codCine = ddlCine.SelectedValue.ToString();
            HttpWebRequest req = WebRequest.Create("http://localhost:49911/Promociones.svc/Promocion/" + codigoCine) as HttpWebRequest;
            req.KeepAlive = false;
            req.Method = "GET";
            HttpWebResponse resp = req.GetResponse() as HttpWebResponse;
            Encoding enc = System.Text.Encoding.GetEncoding(1252);
            StreamReader loResponseStream = new StreamReader(resp.GetResponseStream(), enc);
            string Response = loResponseStream.ReadToEnd();
            //var tbl = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(Response);
            //GridView1.DataSource = tbl;
            //GridView1.DataBind();
            return "";
        }

    }
}